﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;
using Component;

public partial class BackEnd_ImageModify : System.Web.UI.UserControl
{
    public string nameImage = "";
    protected string onclick = "";
    public string _idCat = "";
    ImageInfo info;
    public int idNew = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        _idCat = Request.QueryString[ConstString._idcat] ?? "";
        if (_idCat != "")
        {
            this.onclick = @"OpenWindowUploadFile('FileManagement/File.aspx?id=ctl11_ImageModify1_txtImage&idimg=ctl11_ImageModify1_imageUpload','window','width = 630px, height =520px');";
            ImageInfo ninfor = new ImageInfo();
            ninfor = ImageDB.GetById(ConvertType.ToInt(_idCat));
            Load_Data();
        }
        if (_idCat == "")
        {
            this.onclick = @"OpenWindowUploadFile('FileManagement/File.aspx?id=ctl11_ImageModify1_txtImage&idimg=ctl11_ImageModify1_imageUpload','window','width = 630px, height =520px');";
        }
        //this.onclick = @"OpenWindowUploadFile(""FileManagement/File.aspx?id=" + this.txtImage.ClientID + @"&idimg=" + this.imageUpload.ClientID + @""",""window"",""width = 630px, height =520px"");";
    }
    private void Load_Data()
    {
        info = ImageDB.GetById(int.Parse(_idCat));
        nameImage = info.urlImages;
    }
    protected void cmdLuu_Click(object sender, EventArgs e)
    {
        info = new ImageInfo();
        info.urlImages = txtImage.Value.Trim();
        if (ImageDB.Insert(info))
            lbMessage.Text = ConstString._themTC;
        else
            lbMessage.Text = ConstString._themTB;
        Response.Redirect("Admin.aspx?wand=ImagesList");
    }
}
